import {
    createRouter,
    createWebHistory
} from 'vue-router'

import main from '../views-front/MainView.vue'
import index from '../views-front/IndexView.vue'

const routes = [
    {
        path: '/',
        name: 'main',
        component: main,
        children: [
            {
                path: '',
                name: 'index',
                component: index
            },
            // 比赛列表
            {
                path: '/race-list',
                name: 'race-list',
                component: () => import('../views-front/RaceView.vue')
            },
            // 作品列表
            {
                path: '/works/:id?',
                name: 'works',
                component: () => import('../views-front/WorksView.vue')
            },
            // 搜索
            {
                path: '/search',
                name: 'search',
                component: () => import('../views-front/SearchPage.vue')
            },
            // 个人中心
            {
                path: '/personal',
                name: 'personal',
                component: () => import('../views-front/PersonalView/PersonalView.vue'),
                children: [
                    {
                        path: 'center',
                        name: 'center',
                        component: () => import('../views-front/PersonalView/Tabs/PersonalData.vue')
                    },
                    {
                        path: 'race',
                        name: 'race',
                        component: () => import('../views-front/PersonalView/Tabs/PersonalRace.vue')
                    },
                    {
                        path: 'assess',
                        name: 'assess',
                        component: () => import('../views-front/PersonalView/Tabs/PersonalAssess.vue')
                    },
                    {
                        path: 'notice',
                        name: 'personal-notice',
                        component: () => import('../views-front/PersonalView/Tabs/PersonalNotice.vue')
                    },
                    {
                        path: 'message',
                        name: 'message',
                        component: () => import('../views-front/PersonalView/Tabs/PersonalMessage.vue')
                    }
                ]
            },
            // 作品详情
            {
                path: '/work-detail/:id',
                name: 'work-detail',
                component: () => import('../views-front/WorkDetail/WorkDetailView.vue'),
                children: [
                    {
                        path: '',
                        name: 'work-introduce',
                        component: () => import('../views-front/WorkDetail/WorksIntroduce.vue')
                    },
                    {
                        path: 'work-introduce',
                        name: 'work-introduce',
                        component: () => import('../views-front/WorkDetail/WorksIntroduce.vue')
                    },
                    {
                        path: 'work-comment',
                        name: 'work-comment',
                        component: () => import('../views-front/WorkDetail/CommentBlock.vue')
                    },
                    {
                        path: 'work-show',
                        name: 'work-show',
                        component: () => import('../views-front/WorkDetail/WorkShow.vue')
                    }
                ]
            },
            // 比赛详情
            {
                path: '/race-detail/:id',
                name: 'race-detail',
                component: () => import('../views-front/RaceDetail/RaceDetailView.vue'),
            },
            // 赛事新闻
            {
                path: '/race-news',
                name: 'race-news',
                component: () => import('../views-front/RaceNews/RaceNewsView.vue')
            },
            {
                path: '/news-detail',
                name: 'news-detail',
                component: () => import('../views-front/RaceNews/NewsDetailView.vue')
            }
        ],


    },
    {
        path: '/admin_login',
        name: 'adminLogin',
        component: () => import('../views-background/LoginView.vue'),
    },
    {
        path: '/admin',
        name: 'admin',
        component: () => import('../views-background/AdminView.vue'),
        children: [
            {
                // 赛事管理
                path: 'race_list',
                name: 'racelist',
                component: () => import('../views-background/race-list/RaceListView.vue')
            },
            {
                // 作品管理-选择赛事
                path: 'work_choose_contest',
                name: 'workChooseContest',
                component: () => import('../views-background/Work/WorkChooseContest.vue')
            },
            {
                // 作品管理-选择赛事-作品列表
                path: 'work_choose_contest/work_list',
                name: 'workList',
                component: () => import('../views-background/Work/WorkListView.vue')
            },
            {
                // 动态管理
                path: "contes_news",
                name: "ContesNews",
                component: () =>
                    import("../views-background/ContesNews/ContesNewsView.vue"),
            },
            {
                // 通知管理
                path: "notice",
                name: "notice",
                component: () =>
                    import("../views-background/Notice/NoticeView.vue"),
            },
            {
                // 用户管理
                path: 'user',
                name: 'user',
                component: () => import('../views-background/User/UserView.vue')
            },
            {
                path: 'workedit',
                name: 'workedit',
                component: () => import('../views-background/WorkEditView.vue')
            }
        ]
    },
    {
        // 通配符
        path: '/:pathMatch(.*)*',
        name: 'notFound',
        component: () => import('../views-front/NotFoundView.vue')
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router